<template>
	<view>
		<view class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30">
			<u-form :model="model" ref="uForm" style="width: 100%;">
				<u-form-item label="编码:"><u-input v-model="model.value" type="text" /></u-form-item>
				<u-form-item label="名称:"><u-input v-model="model.label" type="text" /></u-form-item>
				<u-form-item label="排序:"><u-number-box v-model="model.sort"></u-number-box></u-form-item>
			</u-form>
		</view>
		<u-gap height="20"></u-gap>
		<view class="btn-line"><button class="landing" type="primary" style="width: 90%;" @click="bindConfirm">提交</button></view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			model: {
				sort:0
			}
		};
	},
	onLoad(option) {
	},
	methods: {
		bindConfirm() {
			if (this.model.value == undefined || this.model.value == '') {
				this.$u.toast('请选择编码');
				return;
			}
			if (this.model.label == undefined || this.model.label == '') {
				this.$u.toast('请输入名称');
				return;
			}
			this.request({
				url: 'BaseLabel/add',
				method: 'POST',
				data: this.model,
				success: res => {
					if (res.code == 200) {
						uni.navigateBack();
					} else {
						this.$u.toast(res.msg);
					}
				}
			});
		}
	}
};
</script>

<style lang="scss">
	.landing{			height: 84upx;			line-height: 84upx;			border-radius: 44upx;			font-size: 32upx;			background: linear-gradient(left,#FF978D, #FFBB69);		}
</style>
